<template>
	<view>
		<u-modal :show="show" :title="title" :content='content' @confirm="confirm"></u-modal>
		<u-list @scrolltolower="scrolltolower" v-if="show" >
			<u-list-item v-for="(item, index) in noticelist" :key="index"    >


				<view class="order"  @click="handleClick(item)">
					<view class="top">
						<view class="left">
							<uni-text class="cuIcon-titles text-blue"></uni-text>
							<view class="store">{{ item.studentArea }}</view>
							<u-icon name="arrow-right" color="rgb(203,203,203)" :size="26"></u-icon>
						</view>
						<view class="right">
							<view class='cu-tag radius light bg-red'>审核状态:{{item.auditStatus}}</view>
						</view>
					</view>
					<view class="item">
						<view class="left">
							<image :src="goodsUrl" mode="aspectFill"></image>
						</view>
						<view class="content">
							<view class="title u-line-2 text-bold">家教科目:{{ item.studentParentingSubjects||"暂无" }}</view>
							<view class="  text-mauve  textmtop">学员年级:{{item.studentGrade ||"暂无"}}</view>
							<view class=" text-olive textmtop">授课方式:{{item.studentTeachingMethod || "暂无"}}</view>
							<view class="delivery-time textmtop">课时费:{{item.price}}</view>
						</view>
					</view>

					<u-line color="#f1f1f1" margin="24rpx 0 15rpx 0"></u-line>
					<view class="bottom">
						<view class="bottom_left">
							<text class="text-blue">发布时间： {{ item.remark1 }}</text>
							<!-- <view class="progressBox">
								<u-line-progress :percent="60" :active-color="activeColor" :striped="true"
									:stripedActive="true"></u-line-progress>
							</view> -->
						</view>

						<view class="btnBox">
							<!-- <view class="exchange btn">分享课程</view> -->
							<view @click.stop="deleteClick(item)" class="evaluate btn">删除订单</view>
						</view>
					</view>
				</view>
			</u-list-item>
		</u-list>
<view class="page-box" v-else>
			<view>
				<view class="centre" v-if="showcentre">
					<image src="https://cdn.zhoukaiwen.com/noData1.png" mode="widthFix"></image>
					<view class="explain">
						暂无数据
						<view class="tips">可以去看看有其他</view>
					</view>
					<!-- <view class="btn">随便逛逛</view> -->
				</view>
			</view>
		</view>
	</view>
	</view>
	</view>
</template>

<script>
	// import dragButton from './components/drag-button/drag-button';
	export default {
		data() {
			return {
				show: false,
					showcentre: false,
				id:"",
				title: '提示',
				content: '您的要删除此订单吗？',
				noticelist: [],
				editFormFields: {
					pageNum: 1,
					pageSize: 10
				},
				total: 0,
				goodsUrl: 'http://cdn.zhoukaiwen.com/web2.jpg',
				dataList: [{
					id: 'wx202110200093',
					store: '建筑类工单项目',
					progre: 100,

					title: '工单项目',
					describe: '暂无描述',
					time: '2021年10月18日'
				}],
			}
		},
		onLoad(e) {
			console.log(e);
			if (e.id) {
				this.editFormFields.remark2 = e.id
			}



		},
		onShow() {
			this.noticelist = [],
				this.editFormFields.pageNum = 1;
			this.getNoticelist()
		},
		onPullDownRefresh() {
			console.log('refresh');
			// setTimeout(function () {
			// 	uni.stopPullDownRefresh();
			// }, 1000);
			this.noticelist = [],
				this.editFormFields.pageNum = 1;
			this.getNoticelist();
		},
		methods: {
			btnClick() {
				let UserInfo = this.$store.getters.getUserInfo();
				if (UserInfo != null) {
					uni.navigateTo({
						url: '/pages/dz_student/dz_student_edit'

					});

				} else {
					uni.navigateTo({
						url: '/pages/login/login'

					});
				}

			},
			handleClick(item) {
				console.log(item.id)
				uni.navigateTo({
					url: '/pages/user/familyeducation/familyeducation_edit?id=' + item.id

				});
			},
			deleteClick(item) {
				this.show = true
				console.log(item.id)
				this.id= item.id;
			},
			confirm() {
				 
				 this.http.get("wechat/student/deteleid/"+this.id, null, "正在查询数据....").then(data => {
				 	 
				 	if (data.code == 200) {
				 		 this.show = false;
						 this.$toast("删除成功")
						 this.noticelist = [],
						 this.editFormFields.pageNum = 1;
						 this.getNoticelist()
				 	} else {
				 		this.$toast(data.msg)
				 	}
				 })
				 
				 
			},
			
			scrolltolower() {
				// console.log("111")

				console.log(this.editFormFields.pageNum)
				if (this.total > this.editFormFields.pageNum * this.editFormFields.pageSize) {
					this.editFormFields.pageNum++;
					// console.log("请求数据")
					this.getNoticelist();
				}

			},

			getNoticelist() {
				let that = this
				this.http.get("wechat/student/list", this.editFormFields, "正在递交数据....").then(data => {
					uni.stopPullDownRefresh();
					this.showcentre = true;
					if (data.code == 200) {
						var noticelist = this.noticelist;

						data.rows.forEach(function(item) {
							noticelist.push(item);
						})
						this.noticelist = noticelist;
						this.total = data.total;
						if (this.total == 0) {
							this.show = false;
							 
						} else {
							this.show = true;
							 
						}
					} else {
						this.show = false;
						this.$toast(data.msg)
					}
				})
				// that.request('loadNotice','GET').then(res =>{
				// 	console.log(res)
				// 	if(res){
				// 		this.noticelist = res.data
				// 	}
				// })
			}
		}
	}
</script>

<style lang="less" scoped>
	.type_text {
		color: red
	}


	.label {
		// margin-bottom: 40rpx;
		font-size: 24rpx;
		color: #82848f;
	}

	.money {
		font-size: 38rpx;
		font-weight: 700
	}

	.Area {
		font-size: 38rpx;
		font-weight: 400;
		color: #55aaff;
	}

	.Describefather {
		height: 100%;
		// margin-right: 130rpx;
		margin-top: 30rpx;
		padding: 10rpx;
	}

	.Describe {

		font-size: 32rpx;
		// font-weight: 700;
		width: 100%;
		overflow-wrap: break-word;
		line-height: 52rpx;
		// margin: 16rpx 16rpx 26rpx 0;

	}

	.wrapper {
		background-color: #fff;
		padding: 30rpx 24rpx;
		margin-top: 30rpx;
	}

	.margin30 {
		margin-top: 10rpx;
		margin-left: 30rpx;
		margin-right: 30rpx;
	}

	.address {
		margin-top: 30rpx;
	}

	.top30 {
		margin-top: 30rpx;
	}


	.order {
		width: 710rpx;
		background-color: #ffffff;
		margin: 20rpx auto;
		border-radius: 20rpx;
		box-sizing: border-box;
		padding: 20rpx;
		font-size: 28rpx;

		.top {
			display: flex;
			justify-content: space-between;

			.left {
				display: flex;
				align-items: center;

				.store {
					margin: 0 10rpx;
					font-size: 34rpx;
					font-weight: bold;
				}
			}

			.right {
				color: #f29100;

				.progressBox {
					width: 150rpx;
					float: right;
				}
			}
		}

		.item {
			display: flex;
			margin: 20rpx 0 0;


			.left {
				margin-right: 20rpx;

				image {
					width: 260rpx;
					height: 190rpx;
					border-radius: 10rpx;
				}
			}

			.content {

				.title {
					font-size: 28rpx;
					line-height: 45rpx;
				}

				.type {

					margin: 6rpx 0;
					font-size: 24rpx;
					color: #909399;
					text-overflow: -o-ellipsis-lastline;
					overflow: hidden;
					text-overflow: ellipsis;
					display: -webkit-box;
					-webkit-line-clamp: 3;
					line-clamp: 3;
					-webkit-box-orient: vertical;
				}

				.delivery-time {
					color: #0081ff;
					font-size: 24rpx;
				}
			}

			.right {
				margin-left: 10rpx;
				padding-top: 20rpx;
				text-align: right;

				.decimal {
					font-size: 24rpx;
					margin-top: 4rpx;
				}
			}
		}

		.total {
			margin-top: 20rpx;
			text-align: right;
			font-size: 24rpx;

			.total-price {
				font-size: 32rpx;
			}
		}

		.bottom {
			line-height: 70rpx;
			display: flex;
			justify-content: space-between;
			align-items: center;

			.bottom_left {
				display: flex;
				align-items: center;

				.progressBox {
					width: 150rpx;
					float: right;
				}
			}

			.btnBox {
				width: 180rpx;
				display: flex;
				justify-content: space-between;

				.btn {
					line-height: 52rpx;
					width: 140rpx;
					border-radius: 12rpx;
					border: 2rpx solid #909399;
					font-size: 26rpx;
					text-align: center;
					color: #909399;
				}

				.evaluate {
					color: #2979ff;
					border-color: #2979ff;
				}
			}
		}
	}

	.centre {
		text-align: center;
		margin: 200rpx auto;
		font-size: 32rpx;

		image {
			width: 300rpx;
			border-radius: 50%;
			margin: 0 auto;
		}

		.tips {
			font-size: 24rpx;
			color: #999999;
			margin-top: 20rpx;
		}

		.btn {
			margin: 80rpx auto;
			width: 200rpx;
			border-radius: 32rpx;
			line-height: 64rpx;
			color: #ffffff;
			font-size: 26rpx;
			background: linear-gradient(270deg, #1cbbb4 0%, #0081ff 100%);
		}
	}

	.wrap {
		display: flex;
		flex-direction: column;
		height: calc(100vh - var(--window-top));
		width: 100%;
	}

	.swiper-box {
		flex: 1;
	}

	.swiper-item {
		height: 100%;
	}

	.textmall {
		display: -webkit-box;
		/* Webkit内核 */
		overflow: hidden;
		text-overflow: ellipsis;
		-webkit-line-clamp: 3;
		/* 最大行数为3行 */
		-webkit-box-orient: vertical;

	}

	.textmtop {
		margin-top: 30rpx;
	}
	// 暂无数据
	.centre {
		text-align: center;
		margin: 200rpx auto;
		font-size: 32rpx;
	
		image {
			width: 300rpx;
			border-radius: 50%;
			margin: 0 auto;
		}
	
		.tips {
			font-size: 24rpx;
			color: #999999;
			margin-top: 20rpx;
		}
	
		.btn {
			margin: 80rpx auto;
			width: 200rpx;
			border-radius: 32rpx;
			line-height: 64rpx;
			color: #ffffff;
			font-size: 26rpx;
			background: linear-gradient(270deg, #1cbbb4 0%, #0081ff 100%);
		}
	}
</style>
